package com.hoshiicloud.mallshop.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.common.query.OmnipotentWrapper;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.mallshop.feign.hystrix.ShopUserFeignServiceFallback;
import com.hoshiicloud.user.dto.userCenter.MemberDto;
import com.hoshiicloud.user.entity.company.Member;
import com.hoshiicloud.user.entity.store.PlatStore;
import com.hoshiicloud.user.entity.visitors.Visitors;
import com.hoshiicloud.user.param.PlatStoreConsumerPageParam;
import com.hoshiicloud.user.param.PlatStoreQueryParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *  2019/8/12 17:28 qry
 */
@FeignClient(name = "hoshiicloud-user", fallback = ShopUserFeignServiceFallback.class)
public interface ShopUserFeignService {
    // ----------------------------------------↓member↓------------------------------------
    /**
     *  2019/8/23 14:19  qry
     *  根据memberId 获取member数据
     **/
    @GetMapping("/rbac/member/{id}")
    Response<Member> getMembersById(@PathVariable("id") Long id);

    /**
     *  2019/8/23 14:19  qry
     *  根据memberId集合 获取member数据
     **/
    @GetMapping("/rbac/member/getByIds")
    Response<List<Member>> getMembersByIds(@RequestParam("ids")List<Long> ids);
    // ----------------------------------------↑member↑------------------------------------







    // ----------------------------------------↓plat-store↓------------------------------------

    /**
     *  2019/8/23 14:19  qry
     *  根据店铺id  获取店铺信息
     **/
    @GetMapping("/store/plat-store/{id}")
    Response<PlatStore> getPlatStoreById(@PathVariable("id") Long id);

    /**
     *  17:37 2019/8/12 qry
     * 获取总店下的分店列表
     **/
    @PostMapping("/store/plat-store/getPage")
    Response<Page<PlatStore>> getPlatStorePage(@RequestBody PlatStoreQueryParam param);

    /**
     *  通过总店Id查询其分店
     * @param storeId 总店Id
     * @return 该总店的分店列表
     */
    @GetMapping("/store/plat-store/getAllBranchStore")
    Response<List<PlatStore>> listBranchStore(@RequestParam("storeId") Long storeId);

    // ----------------------------------------↑plat-store↑------------------------------------

    @PostMapping("/usercenter/platConsumer/getStoreConsumerPage")
    Response<Page<MemberDto>> getStoreConsumersPage(@RequestBody PlatStoreConsumerPageParam param);



    // ----------------------------------------↓visitors↓------------------------------------
    /**
     *  批量查询访客数
     * @param param 查询条件
     * @return 访客数集合
     */
    @PostMapping("/visitors/visitors/queryBatch")
    Response<List<Visitors>> queryVisitorsBatch(@RequestBody List<OmnipotentWrapper> param);
}
